home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / f2c-stab.9 / f2c-stab / f2c-stabs / fts-f-split-decls < prev    next >
Encoding:
AWK Script  |  1996-02-11  |  1.8 KB  |  75 lines

  1. #!/usr/bin/awk -f
  2. # -*- awk -*-
  3. #
  4. # $Header: /usr/bfr/src/test/RCS/fts-f-split-decls,v 1.1 1995/01/18 17:39:14 abel Exp $
  5. #
  6. #********************************************
  7. #
  8. # split multiple decls of CHARACTER data
  9. #
  10. #********************************************
  11. #
  12. # Written by Alexander L. Belikoff, 1994
  13. # Copyright (C)1994 Alexander L. Belikoff
  14. #
  15. # This program is free software; you can redistribute it and/or modify
  16. # it under the terms of the GNU General Public License as published by
  17. # the Free Software Foundation; either version 2 of the License, or
  18. # (at your option) any later version.
  19. #
  20. # This program is distributed in the hope that it will be useful,
  21. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23. # GNU General Public License for more details.
  24. #
  25. #********************************************
  26. #
  27. # $Log: fts-f-split-decls,v $
  28. # Revision 1.1  1995/01/18  17:39:14  abel
  29. # Initial revision
  30. #
  31. #
  32. #********************************************
  33.  
  34.  
  35. $0 ~ /^      +CHARACTER[ \t\*]/ && $0 ~ /,/ {
  36.     
  37.     res = $0
  38.     gsub(/[ \t]*\*[ \t]*/, "*", res)
  39.     gsub(/[ \t]*\([ \t]*/, "(", res)
  40.     gsub(/[ \t]*\)[ \t]*/, ") ", res)
  41.     gsub(/\) ,/, "),", res)
  42.  
  43.     res = substr(res, index(res, "C"))
  44.     i1 = index(res, " ")
  45.     typ = "      " substr(res, 1, i1)
  46.  
  47.     npc = split(substr(res, i1), pieces, ",")
  48.  
  49.     i = 1
  50.  
  51.     while (i <= npc) {
  52.         res = pieces[i]
  53.         i++
  54.  
  55.         if (index(res, "(") && !index(res, ")")) {
  56.             while (i <= npc) {
  57.                 res = res ", " pieces[i]
  58.                 i++
  59.  
  60.                 if (index(res, ")"))
  61.                     break
  62.             }
  63.         }
  64.  
  65.         print typ " " res
  66.     }
  67.  
  68.     next
  69. }
  70.  
  71.  
  72. { print }
  73.  
  74. # end of $Source: /usr/bfr/src/test/RCS/fts-f-split-decls,v $
  75.